 <head>
    <script type='text/javascript' src='https://www.google.com/jsapi'></script>
    <script type='text/javascript'>
      google.load('visualization', '1', {packages:['table']});
      google.setOnLoadCallback(drawTable);
      function drawTable() {
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Source Ip');
        data.addColumn('number', 'Total # of Records');
		//data.addColumn('number', 'Avg in 5min');
		data.addColumn('number', 'Max in 5min');
		data.addColumn('number', 'Min in 5min');
        data.addRows(<%= @fact_count_by_src_ips.size %>);
        <%for i in 0...@fact_count_by_src_ips.size %>
			<% link = url_for :action=>"src_ip_detail", :id=>@fact_count_by_src_ips[i].src_ip.gsub(".","_"), :p=>params[:p], :to=>params[:to], :from=>params[:from]%>
        	data.setCell(<%=i%>, 0, '<a href="<%= link %>"> <%=@fact_count_by_src_ips[i].src_ip%></a>');
        	data.setCell(<%=i%>, 1, <%= @fact_count_by_src_ips[i].sum_calls %>);
			
			data.setCell(<%=i%>, 2, <%= @fact_count_by_src_ips[i].max_calls %>);
			data.setCell(<%=i%>, 3, <%= @fact_count_by_src_ips[i].min_calls %>);
			//data.setCell(<%=i%>, 2, <%= @fact_count_by_src_ips[i].avg_calls %>);
        <%end%>
        var options = {};
		options["width"] = "900px";
		options["showNumber"] = true;
		options["allowHtml"] = true; 

        var table = new google.visualization.Table(document.getElementById('table_div'));
        table.draw(data, options);
      }
    </script>
  </head>

<div id="table_div"></div>
</div>


